using System;
using Microsoft.SharePoint;

namespace SharePoint.DataMapper
{
	[FieldMapper(typeof(SPFieldDateTime), SPFieldType.DateTime)]
	public class FieldDateTimeMapper : FieldMapper
	{
		protected override SPField AddFieldInternal(ListDataContext context, SPFieldCollection collection, Type propertyType, FieldAttribute attribute)
		{
			SPFieldDateTime field = (SPFieldDateTime)base.AddFieldInternal(context, collection, propertyType, attribute);
			field.DisplayFormat = attribute.DateTimeFormat;
			return field;
		}

		protected override FieldAttribute GetFieldAttributeInternal(SPField field)
		{
			FieldAttribute attribute = base.GetFieldAttributeInternal(field);
			//attribute.DateTimeFormat = ((SPFieldDateTime)field).DisplayFormat;
			return attribute;
		}
	}
}